<%-- 
    Document   : storyedit
    Created on : 2011-3-12, 10:47:38
    Author     : Administrator
--%>

<%@page import="com.brucexx.wedding.controller.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../header.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%
	String flag = StringHelper
			.null2String(request.getParameter("flag"));
	String id = StringHelper.null2String(request.getParameter("id"));

	Story story = BaseModelDAO.loadById(
			NumberHelper.string2Long(id, -1), Story.class);
	if (story == null)
		story = new Story();

	String styleColor = "";
	String title = "";
	if (flag.equals("01")) {
		styleColor = "#108ac6";
		title = "風一般的男子，風一般的故事";
	} else if (flag.equals("02")) {
		styleColor = "#990099";
		title = "默默的生活，默默的祈福";
	}
	String domainBase = request.getScheme() + "://"
			+ request.getServerName() + request.getContextPath() + "/pServer";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>故事，由此开始</title>
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="js/story.js"></script>
</head>
<body style="text-align: center;">
	<form id="uploadForm" action="story_upload.action" method="post"
		enctype="multipart/form-data" target="target_upload">
		<table cellspacing="4px" cellpadding="4px"
			style="margin:10px auto;width: 950px;border: 1px solid <%=styleColor%>;text-align: left;">
			<tr>
				<td colspan="2"
					style="height: 30px;margin:4px auto;padding-top:20px;text-align: center;font-size: 30px;color: white;background-color:<%=styleColor%>;">
					<%=title%></td>
			</tr>

			<tr>
				<td
					style="color: black; font-weight: bold; width: 100px; text-align: right;">博客标题:</td>
				<td><input type="text" id="storyname" name="storyname"
					value="<%=StringHelper.null2String(story.getStoryName())%>"
					size="80" />
				</td>
			</tr>
			<tr>
				<td
					style="color: black; font-weight: bold; width: 100px; text-align: right;">故事内容:</td>
			</tr>
			<tr>
				<td colspan="2"><textarea id="storycontent" name="storycontent"
						rows="10" cols="80"><%=StringHelper.null2String(story.getStoryContent())%></textarea>
				</td>
			</tr>
			<tr>
				<td
					style="color: black; font-weight: bold; width: 100px; text-align: right;">上传图片</td>
				<td><input type="file" id="picpath" name="picpath"> <input
					type="hidden" id="flag" name="flag" value="<%=flag%>" /> <input
					type="hidden" id="id" name="id" value="<%=id%>" /> <input
					type="hidden" id="picname" name="picname" /> &nbsp; &nbsp;<input
					id="uploadBtn" type="button"
					onclick="uploadfile(this,'<%=domainBase%>')" value="上传">
					<div id="picinfo"></div></td>
			</tr>
			<tr>
				<td></td>
				<td>
					<div id="bar" style="display: none">
						<div>
							<div class="processBar" id="processBar"></div>
						</div>
						<div id="processDesc">&nbsp;</div>
					</div></td>
			</tr>
			<tr>
				<td></td>
				<td>提示信息，只允许上传gif,jpg,png,bmp类型的文件</td>
			</tr>
			<tr>
				<td colspan="2" style="text-align: center"><input type="button"
					value="提交" onclick="storycommit(this)">
				</td>
			</tr>
		</table>
		<iframe id='target_upload' name='target_upload' src=''
			style='display: none'></iframe>
	</form>
</body>

<script type="text/javascript">
	var oFCKeditor = new FCKeditor('storycontent');
	oFCKeditor.BasePath = "fckeditor/";
	oFCKeditor.Config["DefaultLanguage"] = "zh-cn";
	oFCKeditor.Height = 400;
	oFCKeditor.Width = '100%';
	oFCKeditor.ReplaceTextarea();

	var oEditer;
	function FCKeditor_OnComplete(editorInstance) {
		oEditer = editorInstance;
	}
</script>
</html>
